package com.by.controller;

import com.by.common.BaseResponse;
import com.by.model.dto.thumb.DoThumbDTO;
import com.by.service.ThumbService;
import com.by.utils.ResultUtils;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lzh
 */
@RestController
@RequestMapping("/thumb")
public class ThumbController {

    @Resource
    private ThumbService thumbService;

    @PostMapping("/do")
    public BaseResponse<Boolean> doThumb(@RequestBody DoThumbDTO doThumbDTO, HttpServletRequest request) {
        Boolean isSuccess = thumbService.doThumb(doThumbDTO, request);
        return ResultUtils.success(isSuccess);
    }

    @PostMapping("/undo")
    public BaseResponse<Boolean> undoThumb(@RequestBody DoThumbDTO doThumbDTO, HttpServletRequest request) {
        Boolean isSuccess = thumbService.undoThumb(doThumbDTO, request);
        return ResultUtils.success(isSuccess);
    }
}
